var Response = {
	template : {
		error : 0,
		flags : 0,
		service : ""
	},
	section : "",
	headerName : "",
	stream : "",
	create : function(serviceName, responseData)
	{
		var resObj = this.makeObject(responseData);

		var response = window[serviceName + "Response"];

		if ( $.isProc(response) ){
			response = new window[serviceName + "Response"]();
		}
		else {
			response = {};
		}

		response.extend(this.template);
		response.extend(resObj);

		response.service = serviceName;

		return(response);
	},
	makeObject : function(resp){
		if ( !resp )
			return(null);

		resp = resp.split("!");

		if ( resp.length < 2 )
			resp = ["tmpResponse", "tmpResponse" + "="+ resp];

		$.eval(resp[1]);

		return( $.eval(resp[0]) );
	},
	parseJSON : function($json)
	{
		$object = JSONConverter().convert($json);

		if ( !$.isObj($object) )
			return( null );

		for ( $member in $object )
		{
			if ( $.isObj($object[$member]) &&
				 $.isDef($object[$member].value) )
				$object[$member] = $object[$member].value;
		}

		return( $object );
	}
};
window.Response = Response;
